import 'package:bluetooth_flutter_plugin_example/custom_dialog/loading_indicator.dart';
import 'package:flutter/material.dart';

// 加载
class LxLoading {
  // 显示加载框
  static show(BuildContext context) {
    showDialog(
      context: context,
      barrierDismissible: false,
      builder: (BuildContext context) {
        return Center(
          child: ClipRRect(
            borderRadius: const BorderRadius.all(Radius.circular(20)),
            child: Container(
              color: Colors.white,
              width: 140,
              height: 140,
              child: const CustomLoadingIndicator(message: "加载中"),
            ),
          ),
        );
      },
    );
  }

  // 取消加载
  static void dismiss(BuildContext context) {
    Navigator.of(context).pop(); // 关闭弹框
  }
}
